<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const obj = {
        id: 9,
        uname: 'zs',
        age: 18,
        hobbit: ['抽烟', '喝酒', '烫头'],
        obj2: {
          id: 10,
          uname: 'ls',
          age: 28,
          hobbit: ['吃饭', '睡觉', '敲代码'],
        },
      }
      //请将 对象中所有的属性都解构成单独的变量，包括子对象和数组，解构出来的数据的变量名可以自己取
      // : { id: myId, uname: myUname, age: myAge, hobbit: myHobbit },
      //并且全部打印

      // let { id, uname, age, hobbit, obj2 } = obj
      // console.log(id, uname, age, hobbit, obj2)
      // let [a, b, c] = hobbit
      // console.log(a, b, c)
      // let { id: myId, uname: myUname, age: myAge, hobbit: myHobbit } = obj2
      // console.log(myId, myUname, myAge, myHobbit)
      let {
        id,
        uname,
        age,
        hobbit,
        hobbit: [a, b, c],
        obj2,
        obj2: {
          id: myId,
          uname: myUname,
          age: myAge,
          hobbit: myHobbit,
          hobbit: [d, e, f],
        },
      } = obj
      console.log(
        id,
        uname,
        age,
        hobbit,
        obj2,
        a,
        b,
        c,
        myId,
        myUname,
        myAge,
        myHobbit,
        d,
        e,
        f
      )
    </script>
  </body>
</html>
